<template>
  <div class="share">
    <div class="shareTop">
      <span @click="gotoIndex">X</span>
      <input type="text" v-model="editText.textTitle">
      <button @click="saveBlod">发布</button>
    </div>
    <div class="InputText">
      <editor-bar v-model="editText.textContent" class="Editor"></editor-bar>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
import EditorBar from '../../components/RichText/wangEditor'
export default {
  data(){
    return{
      editText:{
        author:JSON.parse(sessionStorage.getItem('user')).name,
        identity:JSON.parse(sessionStorage.getItem('user')).level,
        textContent:'',
        textTitle:'',
        introduction:''
      }
    }
  },
  components: {EditorBar},
  methods:{
    saveBlod(){
      // console.log(this.editText)
      // axios.post({
      //   url:'http://localhost:9999/addText',
      //   params:this.editText.editText
      // })
      axios.post('http://localhost:9999/addText',this.editText)
      this.$router.push('/index')
    },
    gotoIndex(){
      this.$router.push('/index')
    }
  }
}
</script>

<style scoped>
button{
  padding: 0;
  margin: 0;
  border: none;
  background-color: transparent;
  outline: none;
}
.share{
  height: 100%;
}
.shareTop{
  border-bottom: 1px #cccccc solid;
  height: 40px;
  text-align: center;

}
.shareTop input{
  /*position: absolute;*/
  /*left:80px;*/
  /*top: 15px;*/
  border: none;
  outline:none;
  margin-top: 10px;
}
.shareTop span{
  display: inline-block;
  line-height: 40px;
  float: left;
}
.shareTop button{
  float: right;
  background-color: red;
  color: white;
  height: 30px;
  width: 60px;
  border-radius: 10px;
  margin-top: 5px;
}
.InputText{
  position: absolute;
  left: 0;
  top: 60px;
  height: 100%;
  width: 100%;
}
.InputText textarea{
  height: 100%;
  width: 98%;
  border: none;
}


</style>